/*
 * Receptor.java
 *
 * Created on 23 de septiembre de 2008, 02:51 PM
 */
 
package CyclopsCliente.GUI;

import CyclopsCliente.RTP.HiloTransmitirRTP;

/**
 *
 * @author  jon
 */
public class ReceptorGUI extends javax.swing.JFrame {    
    
    
    /** Creates new form Receptor */
    public ReceptorGUI() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        Esconder = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        Ip = new javax.swing.JTextField();
        Puerto = new javax.swing.JTextField();
        EmpezarCaptura = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 0, 0)));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/1.gif"))); // NOI18N

        jLabel2.setText("Modo Receptor");

        Esconder.setText("Esconder");
        Esconder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EsconderActionPerformed(evt);
            }
        });

        jLabel3.setText("Ip Observador:");

        jLabel4.setText("Puerto Obsevador:");

        Ip.setText("127.0.0.1");
        Ip.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                IpActionPerformed(evt);
            }
        });

        Puerto.setText("1234");
        Puerto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PuertoActionPerformed(evt);
            }
        });

        EmpezarCaptura.setText("Empezar Captura");
        EmpezarCaptura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EmpezarCapturaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 235, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Ip, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
                    .addComponent(Puerto, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(77, 77, 77)
                .addComponent(jLabel2)
                .addContainerGap(85, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(EmpezarCaptura, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Esconder, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(Ip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(Puerto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(EmpezarCaptura)
                .addGap(18, 18, 18)
                .addComponent(Esconder)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void EsconderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EsconderActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);     
}//GEN-LAST:event_EsconderActionPerformed

    private void IpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IpActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_IpActionPerformed

    private void PuertoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PuertoActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_PuertoActionPerformed

    private void EmpezarCapturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EmpezarCapturaActionPerformed
        // TODO add your handling code here:     
        //ejemplo file:/avmedia.mov 129.144.251.182 42050 
        String[ ] args = new String[ 3 ];
        args[ 0 ] = "vfw://0";// camara                
        args[ 1 ] = this.Ip.getText();
        args[ 2 ] = this.Puerto.getText();
        
        
        HiloTransmitirRTP T = new HiloTransmitirRTP();        
        T.args = args; 
        T.start();
       
    }//GEN-LAST:event_EmpezarCapturaActionPerformed
 
   
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {        
         java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ReceptorGUI().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton EmpezarCaptura;
    private javax.swing.JButton Esconder;
    private javax.swing.JTextField Ip;
    private javax.swing.JTextField Puerto;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables
    

    
}
